package com.lry.basic.juc;


import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;

public class TestSoftRef {
    public static void main(String[] args) {

        ReferenceQueue queue = new ReferenceQueue();
        SoftReference<String> softReference = new SoftReference(new String("dssd"),queue);

        System.out.println(softReference.get());

        softReference.enqueue();

        System.out.println(queue.poll().get());
    }
}
